package com.easyaccount.service;

import com.easyaccount.commons.CommonResp;
import com.easyaccount.dao.DailyAcctDictMapper;
import com.easyaccount.model.Daily;
import com.easyaccount.model.DailyAcctDict;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

@Service
public class DailyService {

    @Resource
    private DailyAcctDictMapper dailyAcctDictMapper;

    public CommonResp list(){
        List<DailyAcctDict> dailyAcctDicts = dailyAcctDictMapper.selectAll();
        List<Daily> dailys = new ArrayList<>();

        for (DailyAcctDict dailyAcctDict : dailyAcctDicts) {
            Daily daily = new Daily();daily.setDailyName(dailyAcctDict.getName());
            dailys.add(daily);
        }
        return CommonResp.success(dailys);
    }

}
